package git.yyge.test.entity;

import lombok.Data;

@Data
public class Stu {
    private String name;

    //语文成绩
    private Integer yw;

    //数学成绩
    private Integer sx;

    //英语成绩
    private Integer yy;

    //物理成绩
    private Integer wl;

    //化学成绩
    private Integer hx;

    private Integer sum;

    private Integer avg;

    public Stu(String line){
        //学生: 王五 | 语文: 52 | 数学: 90 | 英语: 68 | 物理: 74 | 化学: 50
        String[] split = line.split(" \\| ");

        //学生: 王五
        name = split[0].replace("学生: ", "");

        //语文: 52
        yw = Integer.valueOf(split[1].replace("语文: ", ""));


        //数学: 90
        sx = Integer.valueOf(split[2].replace("数学: ", ""));


        //英语: 68
        yy = Integer.valueOf(split[3].replace("英语: ", ""));

        //物理: 74
        wl = Integer.valueOf(split[4].replace("物理: ", ""));
        //化学: 50
        hx = Integer.valueOf(split[5].replace("化学: ", ""));

        sum = yw+sx+yy+wl+hx;
        avg = sum/5;

    }
}
